<?php

include "../../lib/start.php";

check_session();
check_permission(ADM_PERM);

$classe = $_REQUEST['cls'];
$studente = $_REQUEST['stud_id'];

$sel_desc = "SELECT anno_corso, sezione FROM classi WHERE id_classe = $classe";
$res_desc = $db->executeQuery($sel_desc);
$_desc = $res_desc->fetch_assoc();
$desc = $_desc['anno_corso'].$_desc['sezione'];

header("Content-type: text/plain");
$upd = "UPDATE alunni SET id_classe = $classe, classe = '$desc'  WHERE id_alunno = $studente";
try{
	$db->executeUpdate($upd);
} catch (MySQLException $ex){
	print "ko;".$ex->getQuery().";".$ex->getMessage();
	exit;
}
print "ok;$upd";
exit;

?>